from django.db import models

class Author(models.Model):
    class Meta:
        verbose_name_plural = "作者"
        verbose_name = "作者"
    SEX = [
        ("1", "male"),
        ("0", "female")
    ]
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=20, null=False,verbose_name='姓名')
    sex = models.CharField(choices=SEX, max_length=1,verbose_name='性别')
    def __str__(self):
        return "{}".format(self.name)

class Book(models.Model):
    class Meta:
        db_table="book"
    id=models.AutoField(primary_key=True)
    name=models.CharField(max_length=20,null=False)
    price=models.DecimalField(max_digits=4,decimal_places=2)
    isbn_no=models.CharField(max_length=13)
    enterperson=models.CharField(max_length=10,null=True)
